#include <cstdio>

const int N = 3000010;
int n;
int a[N], sta[N], f[N];
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i) {
		scanf("%d", &a[i]);
	}
	int top = 0;
	for (int i = n; i; --i) {
		while (top && a[i] >= a[sta[top]]) --top;
		f[i] = sta[top];
		sta[++top] = i;
	}
	for (int i = 1; i <= n; ++i) {
		printf("%d ", f[i]);
	}
	return 0;
}